from django.db import models


# Create your models here.

class Products(models.Model):
    id = models.AutoField(primary_key=True)
    pname = models.CharField(max_length=100, unique=True, verbose_name="商品名称")
    imgurl = models.CharField(max_length=255, null=True, verbose_name="商品图片链接")
    oldprice = models.DecimalField(max_digits=7, decimal_places=2, verbose_name="原价")  # 原价
    newprice = models.DecimalField(max_digits=7, decimal_places=2, verbose_name="现价")  # 现价
    color = models.CharField(max_length=10, null=True, verbose_name="商品颜色")
    size = models.CharField(max_length=100, null=True, verbose_name="商品尺寸型号")
    count = models.PositiveIntegerField()  # 库存数量
    status = models.IntegerField(null=True, verbose_name="商品状态（0上线，1下线）")
    description = models.TextField(blank=True, null=True, verbose_name="商品描述")
    category_id = models.CharField(max_length=30, null=True, verbose_name="父目录Id")

    class Meta:
        db_table = "product"
